/*
 * Copyright 2008-2009 the original 赵永春(zyc@hasor.net).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.hasor.haweb.session;
import java.io.Serializable;
/**
 * 会话存储器
 * @version : 2015年11月20日
 * @author 赵永春(zyc@hasor.net)
 */
public interface SessionStorage {
    /**
     * Removes the object bound with the specified name from
     * this session Storage. If the attribute does not have an object
     * bound with the specified name, this method does nothing.
     *
     * @param name the name of the object to remove from this session
     * @exception IllegalStateException if this method is called on an invalidated session
     */
    public void removeAttribute(long sessionID, String name);
    /**
     * Binds an object to this session, using the name specified.
     * If an object of the same name is already bound to the session,
     * the object is replaced.
     *
     * <p>If the value passed in is null, this has the same effect as calling 
     * <code>removeAttribute()<code>.
     *
     * @param name the name to which the object is bound; cannot be null
     * @param value the object to be bound
     * @exception IllegalStateException if this method is called on an invalidated session
     */
    public void setAttribute(long sessionID, String name, Serializable value);
    /**
     * Binds an object to this session, using the name specified.
     * If an object of the same name is already bound to the session,
     * the object is replaced.
     *
     * <p>If the value passed in is null, this has the same effect as calling 
     * <code>removeAttribute()<code>.
     *
     * @param name the name to which the object is bound; cannot be null
     * @param value the object to be bound
     * @param lostTime set attribute to invalidated time.
     * @exception IllegalStateException if this method is called on an invalidated session
     */
    public void setAttribute(long sessionID, String name, Serializable value, int lostTime);
    /**
     * Returns the object bound with the specified name in this session, or
     * <code>null</code> if no object is bound under the name.
     *
     * @param name a string specifying the name of the object
     * @return the object with the specified name
     * @exception IllegalStateException if this method is called on an invalidated session
     */
    public Serializable getAttribute(long sessionID, String name);
    
    
    
}